#include <fmt/core.h>
#include <gmpxx.h>
#include <spdlog/common.h>

#include <iostream>
#include <memory>
#include <sstream>

#include "graver/configuration/version.h"
#include "graver/person/person.h"
#include "graver/util/log_util.h"

int main() {
    graver::LogUtil::init(spdlog::level::info, "../logs/app.log");

    std::shared_ptr<spdlog::logger> log = graver::LogUtil::getLogger("app");
    SPDLOG_LOGGER_INFO(log, "cpp hello");

    std::unique_ptr<graver::Person> person = std::make_unique<graver::Person>(23, "laolang");
    SPDLOG_LOGGER_INFO(log, fmt::format(person->sayHello()));
    SPDLOG_LOGGER_INFO(log, fmt::format(person->name()));
    SPDLOG_LOGGER_INFO(log, fmt::format("cpp hello version major is : {}", graver::get_graver_version_major()));
    SPDLOG_LOGGER_INFO(log, fmt::format("cpp hello version major is : {}", graver::get_graver_version_major()));
    SPDLOG_LOGGER_INFO(log, fmt::format("cpp hello version patch is : {}", graver::get_graver_version_patch()));

    std::cout << "=============================" << std::endl;

    mpf_class a("3.14", 100);  // 创建一个浮点数对象并初始化，精度设置为100位
    mpf_class b("1.23", 100);

    mpf_class sum        = a + b;  // 进行浮点数的加法运算
    mpf_class difference = a - b;  // 进行浮点数的减法运算
    mpf_class product    = a * b;  // 进行浮点数的乘法运算
    mpf_class quotient   = a / b;  // 进行浮点数的除法运算

    std::cout << "Sum: " << sum << std::endl;  // 输出结果
    std::cout << "Difference: " << difference << std::endl;
    std::cout << "Product: " << product << std::endl;
    std::cout << "Quotient: " << quotient << std::endl;

    std::stringstream ss;
    ss << sum;
    std::string nums;
    ss >> nums;
    std::cout << "nums: " << nums << std::endl;

    return 0;
}